package com.chuangjiangx.member.basic.ddd.domain.model;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author cj-ch
 * @date 2018/7/20 下午7:21
 * 操作人信息
 */
@Data
public class OperatorInfo {

    private Long merchantId;

    private Long merchantUserId;

    private Long storeUserId;

    private Long storeId;

    public OperatorInfo(Long merchantId, Long merchantUserId, Long storeUserId, Long storeId) {
        this.merchantId = merchantId;
        this.merchantUserId = merchantUserId;
        this.storeUserId = storeUserId;
        this.storeId = storeId;
    }

    public OperatorInfo(Long merchantId, Long merchantUserId, Long storeUserId, Long storeId, String storeAddress, String merchantAddress) {
        this.merchantId = merchantId;
        this.merchantUserId = merchantUserId;
        this.storeUserId = storeUserId;
        this.storeId = storeId;
        this.storeAddress = storeAddress;
        this.merchantAddress = merchantAddress;
    }

    private String storeAddress;
    private String merchantAddress;

    /**
     * 获取操作地址
     * @return
     */
    public String getOperatorAddress(){
        return StringUtils.isNotBlank(this.storeAddress) ?
                this.storeAddress : (StringUtils.isNotBlank(this.merchantAddress) ? this.merchantAddress : "");
    }
}
